-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[NFCI][metadata][LibCallsShrinkWrap] Use create{Unlikely,Likely}BranchWeights #89465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NFCI][metadata][LibCallsShrinkWrap] Use create{Unlikely,Likely}BranchWeights #89465
Conversation
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4
@llvm/pr-subscribers-llvm-transforms Author: Vitaly Buka (vitalybuka) ChangesIt does not look like 2000 is needed here in particular. Full diff: https://github.com/llvm/llvm-project/pull/89465.diff 4 Files Affected:
diff --git a/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp b/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
index 6220f850930969..9fe655e548c22c 100644
--- a/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
+++ b/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
@@ -467,7 +467,7 @@ Value *LibCallsShrinkWrap::generateCondForPow(CallInst *CI,
void LibCallsShrinkWrap::shrinkWrapCI(CallInst *CI, Value *Cond) {
assert(Cond != nullptr && "ShrinkWrapCI is not expecting an empty call inst");
MDNode *BranchWeights =
- MDBuilder(CI->getContext()).createBranchWeights(1, 2000);
+ MDBuilder(CI->getContext()).createUnlikelyBranchWeights();
Instruction *NewInst =
SplitBlockAndInsertIfThen(Cond, CI, false, BranchWeights, &DTU);
diff --git a/llvm/test/Transforms/Util/libcalls-shrinkwrap-double.ll b/llvm/test/Transforms/Util/libcalls-shrinkwrap-double.ll
index 1866fc98fc8d8b..4ac216f85c74c0 100644
--- a/llvm/test/Transforms/Util/libcalls-shrinkwrap-double.ll
+++ b/llvm/test/Transforms/Util/libcalls-shrinkwrap-double.ll
@@ -448,4 +448,4 @@ define void @test_pow_strictfp(i32 %int_val, double %exp) strictfp {
declare double @pow(double, double)
-; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 2000}
+; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 1048575}
diff --git a/llvm/test/Transforms/Util/libcalls-shrinkwrap-float.ll b/llvm/test/Transforms/Util/libcalls-shrinkwrap-float.ll
index 2a08041e2b1e5f..f4dc79759d17ed 100644
--- a/llvm/test/Transforms/Util/libcalls-shrinkwrap-float.ll
+++ b/llvm/test/Transforms/Util/libcalls-shrinkwrap-float.ll
@@ -350,4 +350,4 @@ declare float @log2f(float)
declare float @logbf(float)
declare float @log1pf(float)
-; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 2000}
+; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 1048575}
diff --git a/llvm/test/Transforms/Util/libcalls-shrinkwrap-long-double.ll b/llvm/test/Transforms/Util/libcalls-shrinkwrap-long-double.ll
index 076e958086daaf..c2b981c81c75d7 100644
--- a/llvm/test/Transforms/Util/libcalls-shrinkwrap-long-double.ll
+++ b/llvm/test/Transforms/Util/libcalls-shrinkwrap-long-double.ll
@@ -351,4 +351,4 @@ declare x86_fp80 @log2l(x86_fp80)
declare x86_fp80 @logbl(x86_fp80)
declare x86_fp80 @log1pl(x86_fp80)
-; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 2000}
+; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 1048575}
|
Created using spr 1.3.4 [skip ci]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"2000" apparently originates from the comment at https://reviews.llvm.org/D24414#538699 . If we've since adjusted builtin_expect, making this follow along seems fine. LGTM
…hWeights (llvm#89465) It does not look like 2000 is needed here in particular. Follow up to llvm#89464
It does not look like 2000 is needed here in particular.
Follow up to #89464